import request from "@/service";

export function getLoginKey() { 
    return request({
        url: `/login/qr/key`,
    })
}
export function getQr(data) {
    return request({
        url: `/login/qr/create?timestamp=${Date.now()}`,
        data
    })
}

export function checkStatus(data) {
    return request({
        url: `/login/qr/check?timestamp=${Date.now()}`,
        data
    })
}

// 用户的登录状态
export function loginStatusInterface(data) {
    return request({
        url: `/login/status?timestamp=${Date.now()}`,
        method: 'post',
        data
    })
}

// 获取用户详情状态

export function getUserAccount() { 
    return request({
        url:`/user/account?cookie=${localStorage.getItem('cookie')}`
    })
}

// 登出接口

export function logoutInterface() { 
    return request({
        url:'/logout'
    })
}

//获取用户歌单
export function getPlaylist(data){
    return request({
        url:`/user/playlist?uid=${data}`
    })
}

//新建歌单
export function createPlaylist(data){
    return request({
        url:`/playlist/create?name=${data}`
    })
}

//删除歌单
export function deletePlaylist(data){
    return request({
        url:`/playlist/delete?id=${data}`
    })
}

//更新歌单
export function updatePlaylist(data){
    return request({
        url:`/playlist/update?id=${data.id}&name=${data.name}&desc=${data.desc}&tags=${data.tags}`
    })
}

//获取歌单评论
export function getPlaylistComment(data){
    return request({
        url:`/comment/playlist?id=${data}`
    })
}

//获取歌单详情
export function getPlaylistDetail(data){
    return request({
        url:`/playlist/detail?id=${data}`
    })
}

//获取歌曲详情
export function getPlayDetail(data){
    return request({
        url:`/song/detail?ids=${data}`
    })
}

// 获取歌词接口
export function getLyric(data) {
    return request({
        url: '/lyric',
        data
    })
}

export function getSongUrl(data) {
    return request({
        url: '/song/url/v1',
        data
    })
}

//获取歌曲评论
export function getMusicComment(data) {
    return request({
        url: '/comment/music',
        data
    })
}

//获取喜欢音乐列表
export function getLikeList(data) {
    return request({
        url: '/likelist',
        data
    })
}

//获取最近播放歌曲
export function getRecentSong(data) {
    return request({
        url: '/record/recent/song?limit=10',
        data
    })
}

//对歌单添加或删除歌曲
export function getPlaylistTracks(data) {
    return request({
        url: '/playlist/tracks',
        data
    })
}

//喜欢列表和最近歌曲的评价
export function getLikeMusicComment(data) {
    return request({
        url: '/comment/music',
        data
    })
}

//喜欢专辑信息
export function getAlbum(data) {
    return request({
        url: '/album',
        data
    })
}